# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Otreblan <otreblain@gmail.com>

pkgname=draco
pkgver=1.5.6
pkgrel=2
pkgdesc="A library for compressing and decompressing 3D geometric meshes and point clouds"
arch=('loong64' 'x86_64')
url="https://github.com/google/draco"
license=('Apache')
makedepends=('cmake' 'ninja')
depends=('gcc-libs')
options=('staticlibs')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
sha256sums=('0280888e5b8e4c4fb93bf40e65e4e8a1ba316a0456f308164fb5c2b2b0c282d6')

build() {
    cd "$srcdir/$pkgname-$pkgver"

    CXXFLAGS+=' -ffat-lto-objects'
    cmake \
        -Bbuild \
        -GNinja \
        -DCMAKE_UNITY_BUILD=ON \
        -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_BUILD_TYPE=Release \
        -DBUILD_SHARED_LIBS=ON

    ninja -C build
}

package() {
    cd "$srcdir/$pkgname-$pkgver"

    DESTDIR="$pkgdir" ninja -C build install
}
